﻿#region

using System.Text.RegularExpressions;

#endregion


namespace OMS.Ice.T4Generator.Syntax
{
    internal class StandardControlBlock : Part
    {
        private readonly int _position;

        public StandardControlBlock( Match match )
        {
            Match = match;

            if( match.Groups["content"].Captures.Count > 0 )
            {
                var capture = match.Groups["content"].Captures[0];
                Content = capture.Value;
                _position = capture.Index;
            }
        }

        protected Match Match { get; private set; }

        public override int Index
        {
            get { return Match.Index; }
        }

        public override int Position
        {
            get { return _position; }
        }

        public override int Length
        {
            get { return Match.Length; }
        }

        public string Content { get; private set; }
    }
}